out_list = []
n = 0
i = 0
def out_put(my_input, n):
    for i in range(1, my_input + 1):
        reverse_input = int("".join(reversed(str(i))))
        if int(i) % 7 == 0 and reverse_input == i:
            n+=1
            print(i)
    return n
my_input = int(input("请输入一个小于等于六位的数："))
ol = out_put(my_input, n)
print("总个数为{}".format(ol))